package com.sunlands.zlcx.usercenter.controller;

import com.sunlands.zlcx.usercenter.client.LiveVideoService;
import com.sunlands.zlcx.usercenter.common.annotation.AutoLog;
import com.sunlands.zlcx.usercenter.exception.GlobalExceptionHandler;
import com.sunlands.zlcx.usercenter.service.UsersStudyServiceImpl;
import com.sunlands.zlcx.usercenter.service.VipUserServiceImpl;
import com.sunlands.zlcx.usercenter.vo.response.BusinessResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.WebApplicationContext;

/**
 * @author anjl
 * @date 5:38 PM 2019/6/13
 * description:pathMatcher
 */
@SuppressWarnings("unused")
@Api(tags = "6、测试")
@ApiResponses(value = {@ApiResponse(code = 400, response = GlobalExceptionHandler.class, message = "数据校验失败"), @ApiResponse(code = 500, response = GlobalExceptionHandler.class, message = "内部错误")})
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController implements AuthSupport {


    @Lazy
    @Autowired
    private LiveVideoService liveVideoService;

    @Lazy
    @Autowired
    private UsersStudyServiceImpl usersStudyService;

    @Autowired
    private VipUserServiceImpl vipUserService;
    @Autowired
    private UsersController usersController;

    @AutoLog
    @ApiOperation(value = "测试接口", notes = "测试")
    @PostMapping("/test")
    public BusinessResult<String> upload() throws Exception {
        throw new Exception("测试");
//        usersController.sendPhoneVerifyCode()
//        return null;

    }


    @AutoLog
    @ApiOperation(value = "清洗tz_vip_user_use_record数据")
    @GetMapping("/clean")
    public BusinessResult<String> clean() {

        vipUserService.cleanData();
        return BusinessResult.createSuccessInstance(null);
    }

    @Autowired
    WebApplicationContext applicationContext;

}
